<Window x:Class="LaunchMeNot.WinUpdater"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:loc="clr-namespace:LaunchMeNot"
    xmlns:lex="http://schemas.root-project.org/xaml/presentation"
    xmlns:l49="clr-namespace:Lime49;assembly=Lime49"
    xmlns:l49ui="clr-namespace:Lime49.UI;assembly=Lime49"
    l49:WindowService.EscapeClosesWindow="True"
    Loaded="Window_Loaded" Closing="Window_Closing" x:Name="root" WindowStartupLocation="CenterOwner"
    Title="{lex:LocText LaunchMeNot.Core:Strings:CheckForNewVersion}"
    MinWidth="300" MinHeight="100" Width="500" Height="300" MaxWidth="600" MaxHeight="500" SizeToContent="Height"
    Style="{StaticResource {x:Type Window}}" Icon="/LaunchMeNot;component/Resources/icon.ico">
    <Window.CommandBindings>
        <CommandBinding Command="loc:LaunchMeNotCommands.Abort" Executed="AbortDownload" CanExecute="CanExecuteAbort" />
        <CommandBinding Command="ApplicationCommands.Close" Executed="CloseWindow" CanExecute="CanExecuteCloseWindow" />
        <CommandBinding Command="ApplicationCommands.Open" Executed="LaunchInstall" CanExecute="CanExecuteInstall"/>
    </Window.CommandBindings>
    <Grid Margin="4">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        
        <ProgressBar Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5" x:Name="prgProgress" Minimum="0" Maximum="100" MinHeight="25" IsIndeterminate="False" />
        
        <TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" x:Name="txtProgress" Margin="2,2,5,2" />
        <TextBlock Grid.Row="1" Grid.Column="2" x:Name="txtTotalSize" Margin="2,2,2,5" />

        <TextBlock Grid.Row="2" Grid.Column="0" Text="{lex:LocText LaunchMeNot.Core:Strings:Downloaded}" Margin="2,2,5,2" FontWeight="Bold" />
        <TextBlock Grid.Row="2" Grid.Column="1" x:Name="txtDownloaded" Text="{lex:LocText LaunchMeNot.Core:Strings:Unknown}" HorizontalAlignment="Left" VerticalAlignment="Center" />
        
        <TextBlock Grid.Row="3" Grid.Column="0" Text="{lex:LocText LaunchMeNot.Core:Strings:Remaining}" Margin="2,2,5,2" FontWeight="Bold" />
        <TextBlock Grid.Row="3" Grid.Column="1" x:Name="txtRemaining" Text="{lex:LocText LaunchMeNot.Core:Strings:Unknown}" HorizontalAlignment="Left" VerticalAlignment="Center" />

        <FlowDocumentScrollViewer Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="3" x:Name="txtReleaseNotes" Visibility="Collapsed" Zoom="50" FontFamily="Verdana">
            <!--FlowDocumentPageViewer.Template>
                <ControlTemplate TargetType="{x:Type FlowDocumentPageViewer}">
                    <AdornerDecorator FlowDocumentPageViewer.IsMasterPage="True"/>
                </ControlTemplate>
            </FlowDocumentPageViewer.Template-->
            <!--FlowDocumentPageViewer.Triggers>
                <EventTrigger RoutedEvent="UIElement.IsVisibleChanged">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="txtReleaseNotes" Storyboard.TargetProperty="Height"
                                             From="0" To="250" Duration="0:0:1" AutoReverse="True" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </FlowDocumentPageViewer.Triggers-->
        </FlowDocumentScrollViewer>
        
        <l49ui:Hyperlink Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="3" x:Name="lnkMoreInfo" Text="{lex:LocText LaunchMeNot.Core:Strings:ReadTheReleaseNotes}" Visibility="Collapsed"/>
        
        <StackPanel Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="3" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Content="{lex:LocText LaunchMeNot.Core:Strings:Abort}" Command="loc:LaunchMeNotCommands.Abort" MinWidth="70" Margin="2,2,4,2" />
            <Button Content="{lex:LocText LaunchMeNot.Core:Strings:Install}" Command="ApplicationCommands.Open" MinWidth="70" />
            <Button Content="{lex:LocText LaunchMeNot.Core:Strings:Close}" Command="ApplicationCommands.Close" MinWidth="70" />
        </StackPanel>
    </Grid>
</Window>
